#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,last=1;
int a[100005];
int bin[100005];
int pos[100005];
int tmp,ans;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i],bin[a[i]]++;
    for(int i=1;i<=100000;i++) pos[i]=pos[i-1]+bin[i];
    sort(a+1,a+n+1);
    for(int i=1;i<=n;){
        while(a[i]>a[last]){
            int tmp_bin=bin[a[i]];
            tmp=min(bin[a[last]],bin[a[i]]);
            last+=tmp,ans+=tmp;tmp_bin-=tmp;
            if(tmp_bin==0) break;
        }
        i=pos[a[i]]+1;
    }
    cout<<n-ans<<'\n';
    return 0;
}
